import 'package:flutter/services.dart';

class AppUtil{
  // true表示横屏 false 表示竖屏
  void setScreenLandscape(bool landScape) {

    if(landScape) {
      // 强制横屏
      SystemChrome.setPreferredOrientations([
        DeviceOrientation.landscapeLeft,
        DeviceOrientation.landscapeRight
      ]);
    } else {
      // 强制竖屏
      SystemChrome.setPreferredOrientations(
          [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
    }
  }
}